#ifndef _UTILS_JSON_
#define _UTILS_JSON_

#include <boost/property_tree/json_parser.hpp>
#include <string>
#include <vector>

namespace Utils
{

  class Json
  {
    public:
      static void PushBack(boost::property_tree::ptree& t,std::vector<std::string>& l,const std::string& name)
      {
        for (size_t i = 0; i < l.size(); ++i)
        {
          boost::property_tree::ptree child;
          child.put(name,l[i]);
          t.push_back(std::make_pair("",child));
        }

      };

      static void WriteJson(boost::property_tree::ptree& t,std::ostream& headers,std::ostream& out)
      {
        std::stringstream s;
        write_json(s,t);
        headers << "Content-type: text/json\r\n";
        out << s.str();
      };

  };

};
#endif
